package Memmory;

import java.nio.ByteBuffer;

public class Word {
    private byte[] value;
    
    public Word() {
        value = new byte[4];
    }
    
    public Word(byte[] value) {
        this();
        System.arraycopy(value, 0, this.value, 0, value.length);
    }
    
    public Word(int a, int b, int c, int d) {
        this();
        value[0] = (byte)a;
        value[1] = (byte)b;
        value[2] = (byte)c;
        value[3] = (byte)d;
    }
    
    public Word(int integer32) {
        this();
        value = ByteBuffer.allocate(4).putInt(integer32).array();
    }
    
    public void setValue(byte[] value) {
        System.arraycopy(value, 0, this.value, 0, 4);
    }
    
    public void setValue(int a, int b, int c, int d) {
        value[0] = (byte)a;
        value[1] = (byte)b;
        value[2] = (byte)c;
        value[3] = (byte)d;
    }
    
    public void setValue(int integer32) {
        value = ByteBuffer.allocate(4).putInt(integer32).array();
    }
    
    public byte[] getBytes() {
        return value;
    }
    
    public int getNumber() {
        return ByteBuffer.wrap(value).getInt();
    }
}
